#pragma once
#include <boost/asio/io_service.hpp>
#include <boost/asio/serial_port.hpp>
#include <boost/shared_ptr.hpp>

#define FD_INVALID "'fd' field is not found."
#define PORT_NOT_OPENED "Serial Port may not be opened correctly"


#ifdef  __ANDROID__
#include  <android/log.h>
// log标签
#define  TAG    "LibSerialPort"
// 定义info信息
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,TAG,__VA_ARGS__)
// 定义debug信息
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__)
// 定义error信息
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,TAG,__VA_ARGS__)
#else
#include <stdio.h>
// 定义info信息
#define LOGI(...) printf(__VA_ARGS__)
// 定义debug信息
#define LOGD(...) printf( __VA_ARGS__)
// 定义error信息
#define LOGE(...) printf(__VA_ARGS__)
#endif

typedef boost::asio::io_service io_service;
typedef boost::shared_ptr<io_service> io_service_ptr;
typedef boost::asio::serial_port serial_port;
typedef boost::asio::io_service::work worker;
typedef boost::shared_ptr<serial_port> serial_port_ptr;

#define parity_none  0
#define parity_odd  1
#define parity_even  2

#define stop_one  0
#define stop_onePointFive 1
#define stop_two 2